function dec2Bin(a) {
    var stack = []
    var rember
    while(a > 0) {
        rember = a % 2
        a = Math.floor(a / 2)
        stack.push(rember)
    }
    var bin
    while(stack.length) {
        bin = stack.pop()
        console.log(bin);
    }
}

dec2Bin(100)